home *** CD-ROM | disk | FTP | other *** search
/ Just Call Me Internet / Just Call Me Internet.iso / com / computer / casio_st / prog_fx / oisac2 / l_5200.txt < prev    next >
Text File  |  1994-03-01  |  2KB  |  32 lines

  1. 5 ONERRORGOTO1000
  2. 10 DEFCHR$(255)="0000FE0000":MODE8:DIM:PRINTCHR$(15);
  3. 30 f$="":c$=CHR$(5):a=0:b=0:e=1e-7:m=8:ANGLE1:ERASEa:DIMa(m)
  4. 50 CLS:PRINT"Romberg's method  ôf(x)dx [a,b] 1:f(x),[a,b]      2:î,loop";
  5. 60 k=ASC(INPUT$(1,@)):IFk=13ORk=49THEN90ELSEIFk=50THEN170
  6. 80 GOTO60
  7. 90 CLS:PRINT"Define function";
  8. 100 LOCATE0,1:PRINTc$;"f(x) ?";f$;:LOCATE0,0:LOCATE6,1:INPUT@100;f$:LOCATE0,0:z=VALF(f$)
  9. 110 IFLEN(f$)<21THENg$=f$ ELSEg$=LEFT$(f$,17)+"¥¥¥"
  10. 120 m$="ô "+g$+" dx [a,b]":s$="a":z=a:GOSUB800:a=z
  11. 130 s$="b":z=b:GOSUB800:b=z:GOTO250
  12. 170 m$="Err  ïAn+1-Anï<î  (î>0)":s$="î":z=e:GOSUB800:e=z:IFe<1e-90 THEN170
  13. 200 m$="Max loop  2ü     (n>0)":s$="n":z=m:GOSUB800:m=z:IFm=<0ORFRACm<>0THEN200ELSEERASEa:DIMa(m):GOTO50
  14. 250 CLS:PRINTm$;TAB(0);"ôf(x)dx = .....";
  15. 260 h=b-a:x=a:g=VALF(f$):x=b:f=VALF(f$):a(0)=(g+f)*h/2
  16. 300 FORi=1 TOm:h=h/2
  17. 310 s=0:FORj=1TO2^i-1STEP2:x=a+j*h:s=s+VALF(f$):NEXT
  18. 320 a(i)=a(i-1)/2+h*s
  19. 330 n=1:FORk=i-1TO0STEP-1
  20. 340 a(k)=a(k+1)+(a(k+1)-a(k))/(4^n-1)
  21. 350 IFABS(a(k+1)-a(k)) <e AND(i>3ORi=m)THENx=a(k):GOTO500
  22. 360 n=n+1:NEXT:NEXT:GOSUB450
  23. 390 PRINTc$;"n =";m;TAB(11);":An =";STR$(a(m-1));:LOCATE0,0:LOCATE1,1:z$=INPUT$(1,@):GOTO50
  24. 450 LOCATE0,1:PRINTc$;"not found";:z$=INPUT$(1,@):RETURN
  25. 500 x=ROUND(x,INTLOG(ABSe)-1):PRINTc$;"ôf(x)dx =";x;:z$=INPUT$(1,@):GOTO50
  26. 800 CLS:PRINTm$;
  27. 810 LOCATE0,1:PRINTc$;s$"=";z;"?";:INPUT@10;z:LOCATE0,0:RETURN
  28. 1000 IFERR=1 THENCLS:ONERRORGOTO0
  29. 1010 IFERL=100 THENIFERR=2 THENRESUME100 ELSERESUMENEXT
  30. 1015 IFERL=810 THENRESUME810
  31. 1020 GOSUB450:RESUME50
  32.